﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Components
{
    public class ManualStart : WorkflowTrigger
    {
        #region Overrides of WorkflowComponentBase

        private ManualStartInstruction _Instruction;
        public override InstructionBase Instruction
        {
            get { return _Instruction; }
            set { _Instruction = (ManualStartInstruction)value; }
        }

        private ManualStartOutput _Output;
        public override ResultBase Output
        {
            get { return _Output; }
            set { _Output = (ManualStartOutput)value; }
        }

        #endregion

        public ManualStart():base()
        {
            this.ComponentName = "Manual start";
            this.Description = "Manually start the workflow";
            this.ComponentIconName = "Mouse.png";
            this.ComponentImageName = "Mouse.png";

            this._Instruction=new ManualStartInstruction();
            this._Output=new ManualStartOutput();
        }

        #region Overrides of WorkflowTrigger

        public override TriggerType TriggerType
        {
            get { return TriggerType.ManualStart; }
        }

        public override bool CanRun()
        {
            if (this._Instruction.IsActive)
                return true;
            else
                return false;
        }

        public override void UpdateNextRun()
        {
            this._Instruction.IsActive = false;
        }

        #endregion
    }
}
